/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.util.*;

/**
 * This class represents a mapping from the domain of views and relations,
 * to the domain of BitSet genes.
 * It manages the locations(indexes) of the relations in the BitSet gene.
 * Generally genes have different length, represented by bitLength attr.,
 * depending of the view's level of aggregation.
 * @author Dragan Sahpaski
 */
public class ViewGene extends Table {

    public ViewGene(String name, List<Table> fkRelations) {
        super(name, 1, new PrimaryKey(new Atribute(name + "_ID")), new ArrayList<Atribute>());
        this.fkRelations.clear();
        this.fkRelations.addAll(fkRelations);
        this.numberOfTuples = 1;
        for (Table rel : this.fkRelations) {
            numberOfTuples *= rel.getNumberOfTuples();
        }
    }
}
